package cn.novel.bm.controller.user;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

@RequestMapping(value = "/users", produces = MediaType.APPLICATION_JSON_VALUE)
@RestController
@Api(tags = "用户管理")
public class UserController {

    @PostMapping
    @ApiOperation(value = "创建用户")
    @ApiResponses({
            @ApiResponse(responseCode = "200", description = "正常返回"),
            @ApiResponse(responseCode = "201", description = "用户已创建"),
            @ApiResponse(responseCode = "401", description = "用户未登陆"),
            @ApiResponse(responseCode = "403", description = "没有权限访问"),
            @ApiResponse(responseCode = "404", description = "资源不存在"),
            @ApiResponse(responseCode = "502", description = "系统错误")

    })
    public void create(@RequestBody UserCreateReq userCreateReq) {
    }

    @PatchMapping(path = "/{userId}")
    @ApiOperation(value = "编辑用户")
    public void edit(@PathVariable Integer userId, @RequestBody UserEditReq userEditReq) {

    }

    @ApiOperation(value = "用户查询列表")
    @GetMapping
    public UserQueryRes[] findList(@RequestBody UserQueryReq userQueryReq) {
        return null;
    }


    @ApiOperation(value = "用户登陆")
    @PostMapping(path = "/session")
    public UserLoginRes login(@RequestPart @ApiParam(value = "用户名", name = "userName") String userName,
                                              @RequestPart @ApiParam(value = "密码", name = "password") String password) {
        return null;
    }

    @DeleteMapping(path = "/session")
    @ApiOperation(value = "用户退出")
    public void logout() {

    }


    @ApiOperation(value = "修改密码")
    @PutMapping(path = "/session/password")
    public void changePassword(
            @RequestPart @ApiParam(value = "密码") String password) {

    }

    @ApiOperation(value = "重置密码")
    @DeleteMapping(path = "/{userId}/password")
    public void resetPassword(
            @PathVariable @ApiParam(value = "用户Id") String userId) {

    }

    @ApiOperation(value = "用户锁定")
    @PostMapping(path = "/{userId}/lock")
    public void lock(@PathVariable @ApiParam(value = "用户Id") String userId) {

    }

    @ApiOperation(value = "用户解锁")
    @DeleteMapping(path = "/{userId}/lock")
    public void unLock(@PathVariable @ApiParam(value = "用户Id") String userId) {

    }
}
